package com.own.center;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.own.core.html.form.checkBox.CheckBox;
import com.own.core.html.form.dropDown.DropDown;
import com.own.core.html.form.textField.TextField;
import com.own.core.object.Dao;

@Entity
@Table(name = "cm_seat")

@NamedQueries({ @NamedQuery(name = "seat.listByHole", query = "select s from Seat  s " +
		" join s.hole h " +
		" where h.id=:id ") })
public class Seat extends Dao {
	
	private long id;

	@TextField(required = true, list = true)
	private String name;
	
	@CheckBox
	private boolean active=true;


//	@DropDown
	private Hole hole;
	
	public Seat(String name, Hole hole ) {
		this.name=name;
		this.hole=hole;
	}

	public Seat( ) {
		 
	}

	@Id
	@GeneratedValue(strategy = GenerationType.TABLE)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "hole_id", nullable = true)
	public Hole getHole() {
		return hole;
	}

	public void setHole(Hole hole) {
		this.hole = hole;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}
}
